<?php
class TravelDestinationController extends Apps_Controller_Action_Default {
	public function indexAction() {
		$cId = $this->_request->getParam('id');

    	$validator = new Zend_Validate_Db_NoRecordExists(array('table' => 'country', 'field' => 'id'));
    	if(!$cId  || $validator->isValid($cId)) {
    		$this->_redirect('');
    	}

    	$articleModel = new M_Article();
        $listArticle  = $articleModel->listRegionArticle($cId, M_DbTable_Article::REGION_ARTICLE_TYPE_TRAVEL_DESTINATION);
        $this->setPagination($listArticle, $this->_request, 5);

    	$countryModel = new M_Country();
    	$this->view->country = $countryModel->getCountryById($cId)->query()->fetch();
    	$this->view->type    = M_DbTable_Article::REGION_ARTICLE_TYPE_TRAVEL_DESTINATION;
	}
}